package com.ruoyi.heima.service.impl;
import com.ruoyi.heima.mapper.TbNewsMapper;
import com.ruoyi.heima.service.NewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;

@Service
public class NewServiceImpl implements NewService {

    @Autowired private TbNewsMapper tbnewsMapper;

    /**
     * 定时删除新闻
     */
    @Override
    public void deledeNews() {
        //删除状态为删除且更新时间为7天前的新闻
        LocalDateTime sevenDaysAgo = LocalDateTime.now().minusDays(7);
        tbnewsMapper.deletenew(sevenDaysAgo);
    }
}

